package com.shuai.dynamicProxy.cglib;

import com.shuai.dynamicProxy.cglib.proxy.CjlibDynamicProxyFactory;
import com.shuai.dynamicProxy.cglib.proxy.UserServiceCglibInterceptor;
import com.shuai.dynamicProxy.jdk.proxy.UserServiceInvocationHandler;
import com.shuai.staticProxy.service.UserService;
import org.springframework.cglib.proxy.Enhancer;

import java.util.ArrayList;

/**
 * @author shuaihong-coding
 * @date 2025/10/3
 * @className JdkDynamicProxyMain
 */
public class CglibDynamicProxyMain {

    public static void main(String[] args){
        // 使用cjlib
        UserService userServiceProxy = CjlibDynamicProxyFactory.getProxy(UserService.class, new UserServiceCglibInterceptor());
        String userInfo = userServiceProxy.getUserInfo("帅宏");
        System.out.println(userInfo);
        ArrayList<String> userList = new ArrayList<>();
        userList.add("帅");
        userList.add("小米");
        userList.add("小白");
        String userAll = userServiceProxy.getUserAll(userList);
        System.out.println(userAll);
    }

}
